package com.trkj.focusonzhuzhou.tipoffAdapter;

import java.util.List;

import com.trkj.focusonzhuzhou.R;
import com.trkj.focusonzhuzhou.tipoff.Comments;
import com.trkj.focusonzhuzhou.tipoff.ViewHolder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;

public class TipoffCommentsAdapter extends BaseAdapter {
	private Context context;
	private List<Comments> list;

	public TipoffCommentsAdapter(Context context, List<Comments> list) {
		super();
		this.context = context;
		this.list = list;
	}

	public TipoffCommentsAdapter() {
		super();
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		ViewHolder viewholder;
		if (arg1 == null) {
			arg1 = LayoutInflater.from(context).inflate(R.layout.comments_itm,
					null);
			viewholder = new ViewHolder();
			viewholder.users = (TextView) arg1.findViewById(R.id.textname_id);

			viewholder.time = (TextView) arg1.findViewById(R.id.texttime_id);

			viewholder.edcontent = (TextView) arg1
					.findViewById(R.id.commentsq_id);

		
			arg1.setTag(viewholder);

		} else {
			viewholder = (ViewHolder) arg1.getTag();
		}
		final Comments com = list.get(arg0);
		viewholder.users.setText(com.users);
		viewholder.time.setText(com.time);
		viewholder.edcontent.setText(com.edcontent);


		return arg1;
	}

}
